﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace FIS.iDET
{
    public class DataColumn
    {
        public DataColumn()
        {
            // set default values
            _width = 100;
            _type = DataTypeEnum.COLUMN_TYPE_TEXT;
            _header = "Untitled";
            x = y = w = h = 0;
        }

        public DataColumn(string header)
        {
            // set default values
            _width = 100;
            _type = DataTypeEnum.COLUMN_TYPE_TEXT;
            _header = header;
            x = y = w = h = 0;
        }

        public DataColumn(string header, int type, int width, DoubleRectangle rect)
        {
            // set default values
            _width = width;
            _type = type;
            _header = header;
            x = rect.X;
            y = rect.Y;
            w = rect.Width;
            h = rect.Height;
        }

        private double x, y, w, h;

        public DataColumn(string header, int type, int width, double x, double y, double w, double h)
        {
            // set default values
            _width = width;
            _type = type;
            _header = header;
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;
        }

        public DataColumn (DataColumn datacol)
        {
            this._header = datacol.Header;
            this._width = datacol.Width;
            this._type = datacol.Type;
            this.x = datacol.x;
            this.y = datacol.y;
            this.w = datacol.w;
            this.h = datacol.h;
        }

        public DoubleRectangle Rect
        {
            get
            {
                return new DoubleRectangle(x, y, w, h);
            }
            set
            {
                x = value.X; y = value.Y; w = value.Width; h = value.Height;
            }
        }

        public double X { get { return x; } set { this.x = value; } }
        public double Y { get { return y; } set { this.y = value; } }
        public double W { get { return w; } set { this.w = value; } }
        public double H { get { return h; } set { this.h = value; } }

        private int _width;

        public int Width
        {
            get
            {
                return _width;
            }
            set
            {
                _width = value;
            }
        }

        private int _type;

        public int Type
        {
            get
            {
                return _type;
            }
            set
            {
                _type = value;
            }
        }

        private string _header;

        public string Header
        {
            get
            {
                return _header;
            }
            set
            {
                _header = value;
            }
        }
    }
}
